<template>
  <div>
   
  </div>
</template>

<script>
export default {
  components: {},
  data() {
    return {
      isConfirm: true,
      limitNum: 1,
      formInline: {
        starttime: "",
        endtime: "",
        recipe: "",
        line: "",
        site: "",
        class: "",
        order: "",
        type: [],
        fileList: [],
      },
      options: [
        {
          value: "选项1",
          label: "yield",
        },
        {
          value: "选项2",
          label: "quality",
        },
        {
          value: "选项3",
          label: "defect",
        },
        {
          value: "选项4",
          label: "activation",
        },
        {
          value: "选项5",
          label: "lightup",
        },
      ],
      restaurants: [],
    };
  },
  sockets: {
    detetion: function (data) {
      console.log("后端返回的数据", data);
    },
 
   reconnect(){
     console.log('服务断开，自动连接')
    //  this.$alert("服务端断开连接,正在自动重新连接", "消息提示", {
    //       confirmButtonText: "确定",
    //       callback: (action) => {
    //         this.$message({
    //           type: "info",
    //           message: `action: ${action}`,
    //         });
    //       },
    //     });
      //  this.$socket.emit('connect',1)   
   },

     disconnect() {
      console.log("服务端断开连接");
      this.$alert("服务端断开连接，请开启服务重新连接", "消息提示", {
          confirmButtonText: "确定",
          callback: (action) => {
            this.$message({
              type: "info",
              message: `action: ${action}`,
            });
          },
        });
    },
  },
  mounted() {
    // console.log(this.state2);
    // this.restaurants = this.loadAll();
  },
  methods: {
    getdata() {
       if (this.formInline.recipe == "") {
        this.$alert("机种编码不能为空", "消息提示", {
          confirmButtonText: "确定",
          callback: (action) => {
            this.$message({
              type: "info",
              message: `action: ${action}`,
            });
          },
        });
      } else {
          
        //  this.$socket.emit("getdata", this.formInline);
        // console.log('222222222222222222222',this.$socket.id)
      }
    },
    loadAll() {
      // return [{ value: "三全鲜食（北新泾店）", address: "长宁区新渔路144号" }];
    },
    querySearch(queryString, cb) {
      var restaurants = this.restaurants;
      var results = queryString
        ? restaurants.filter(this.createFilter(queryString))
        : restaurants;
      // 调用 callback 返回建议列表的数据
      cb(results);
    },
    createFilter(queryString) {
      return (restaurant) => {
        return (
          restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) ===
          0
        );
      };
    },
    handleSelect(item) {
      console.log(item);
    },
    handleIconClick(ev) {
      console.log(ev);
    },
    // 文件状态改变时的钩子
   fileChange(file, fileList) {
      if (!this.isConfirm) {
        this.isConfirm = true;
        return;
      }
       this.$confirm("上传文件, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "info",
      })
        .then(() => {
          console.log("确定上传");
          return true;
        })
        .catch(() => {
          this.$refs.uploadExcel.clearFiles();
          console.log("取消上传");
          return false;
        });
     

      this.formInline.fileList = fileList.slice(-3);
      // console.log('------------->',this.formInline.fileList)
    },
    //文件上传超出数量
    exceedFile(files, fileList) {
      this.$notify.warning({
        title: "警告",
        message: `只能选择 ${this.limitNum} 个文件，当前共选择了 ${
          files.length + fileList.length
        } 个`,
      });
    },
    // 文件上上传之前的钩子
    beforeUploadFile(file) {
      const extension = file.name.substring(file.name.lastIndexOf(".") + 1);
      const size = file.size / 1024 / 1024;
      if (extension !== "xlsx") {
        this.$notify.warning({
          title: "警告",
          message: `只能上传Excel（即后缀是.xlsx）的文件`,
        });
      }
      if (size > 10) {
        this.$notify.warning({
          title: "警告",
          message: `文件大小不得超过1M`,
        });
      }
    },
  
  },
};
</script>

<style  scoped>
.table_serch {
  width: 100%;
  min-width: 1000px;
  padding-top: 8px;
  /* border: 1px solid red; */
  background: #fff;
  display: flex;
  flex-wrap: wrap;
}
.table_serch_labe {
  /* border: 1px solid #000; */
  height: 35px;
  display: flex;
  margin-left: 10px;
  margin-bottom: 10px;
}
.table_serch_labe_title {
  font-size: 11px;
  line-height: 40px;
}
.el-button_eb {
  margin-left: 5px;
  color: #fff;
}
.el-select {
  height: 10px;
  margin-left: -6px;
}
.product {
  width: 120px;
}
</style>